<%@ page import="com.lagou.demo03.model.Class" %>
<%@ page import="java.util.List" %>
<%@ page import="com.lagou.demo03.service.ClassQueryService" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="static/css/bootstrap.min.css">
    <title>班级信息</title>
</head>
<body style="padding:30px;">

<form class="form-inline" action="classDel" method="post">
    <div class="form-group">
        <!-- 新增按钮采用模态框进行班级信息的输入 -->
        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal" id="add" onclick="ch(1)">新增</button>
        <button type="submit" class="btn btn-primary" >删除</button>
        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#updateModal" id="update" onclick="ch(2)">编辑</button>
        <button type="button" class="btn btn-primary" onclick="window.location='queryStudent.jsp'">查询</button>
    </div>
    <div class="form-group">
        <input type="text" class="from-control" placeholder="按班级名称删除" id="delClassName" name="delClassName">
    </div>

</form>
<%--修改班级信息--%>
<form action="classUpdate" method="post" >
    <!-- 声明定义模态框组件 -->
    <div class="modal" id="updateModal" data-backdrop="static" >
        <!-- 窗口声明 -->
        <div class="modal-dialog">
            <!-- 内容声明 -->
            <div class="modal-content">
                <!-- 1.框的标题 -->
                <div class="modal-header">
                    <button class="close" data-dismiss="modal">
                        <span>&times;</span>
                    </button>
                    <h4 class="modal-title">请输入班级信息</h4>
                </div>

                <!-- 2.框内信息 -->
                <div class="modal-body">
                    <label>修改的班级的名称</label>
                    <input type="text" id="updateClassName" name="updateClassName" placeholder="请输入班级名称">
                    <hr>
                    <label>班级名称</label>
                    <input type="text" id="uclassName" name="uclassName" placeholder="请输入班级名称">
                    <hr>
                    <label>年级</label>
                    <input type="text" id="ugrade" name="ugrade" placeholder="请输入年级">
                    <hr>
                    <label>班主任名称</label>
                    <input type="text" id="uteacher" name="uteacher" placeholder="请输入班主任名称">
                    <hr>
                    <label>口号</label>
                    <input type="text" id="uslogan" name="uslogan" placeholder="请输入班级口号">
                    <hr>
                    <label>班级人数</label>
                    <input type="text" id="uclassNumber" name="uclassNumber" placeholder="请输入班级人数">
                    <hr>
                </div>
                <!-- 3.框的按钮 -->
                <div class="modal-foter" style="float:right">
                    <button type="submit" class="btn btn-info">确定</button>
                    <button class="btn btn-warning" data-dismiss="modal">取消</button>
                </div>

            </div>
        </div>
    </div>
</form>

<form action="class" method="post" >
    <!-- 声明定义模态框组件 -->
    <div class="modal" id="myModal" data-backdrop="static" >
        <!-- 窗口声明 -->
        <div class="modal-dialog">
            <!-- 内容声明 -->
            <div class="modal-content">
                <!-- 1.框的标题 -->
                <div class="modal-header">
                    <button class="close" data-dismiss="modal">
                        <span>&times;</span>
                    </button>
                    <h4 class="modal-title">请输入班级信息</h4>
                </div>

                <!-- 2.框内信息 -->
                <div class="modal-body">
                    <label>班级名称</label>
                    <input type="text" id="className" name="className" placeholder="请输入班级名称">
                    <hr>
                    <label>年级</label>
                    <input type="text" id="grade" name="grade" placeholder="请输入年级">
                    <hr>
                    <label>班主任名称</label>
                    <input type="text" id="teacher" name="teacher" placeholder="请输入班主任名称">
                    <hr>
                    <label>口号</label>
                    <input type="text" id="slogan" name="slogan" placeholder="请输入班级口号">
                    <hr>
                    <label>班级人数</label>
                    <input type="text" id="classNumber" name="classNumber" placeholder="请输入班级人数">
                    <hr>

                </div>
                <!-- 3.框的按钮 -->
                <div class="modal-foter" style="float:right">
                    <button type="submit" class="btn btn-info">确定</button>
                    <button class="btn btn-warning" data-dismiss="modal">取消</button>
                </div>

            </div>
        </div>
    </div>
</form>
<%--<%List<Student>studentList = (List<Student>) request.getAttribute("list");%>--%>
<%
    List<Class> classList = new ClassQueryService().classItemService();
    pageContext.setAttribute("classList",classList);
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!-- 全部员工信息 -->
<table class="table table-responsive">
    <!-- 标题 -->
    <thead>
    <tr>
        <th>序列</th>
        <th>班级</th>
        <th>年级</th>
        <th>老师</th>
        <th>口号</th>
        <th>人数</th>
    </tr>


    <!-- 信息条目 -->
    <%--    采用jstl的循环标签更新代码--%>
    <c:forEach var="s" items="${classList}">
        <!-- 信息条目 -->
        <tr class="info" name="item">
            <td><input type="radio" name="num"></td>
            <td name="userClassName">${s.className}</td>
            <td name="userGrade">${s.grade}</td>
            <td name="userTeacher">${s.teacher}</td>
            <td name="userSlogan">${s.slogan}</td>
            <td name="userClassNumber">${s.classNumber}</td>
        </tr>
    </c:forEach>

    </thead>
</table>


<!-- 引入js -->
<script src="static/js/jquery-3.3.1.min.js"></script>
<script src="static/js/bootstrap.min.js"></script>



</body>
</html>
